# Common path for model generation with Autotiler

MODEL_LIB_POW2 += $(TILER_CNN_KERNEL_PATH)/CNN_BiasReLULinear_BasicKernels.c
MODEL_LIB_POW2 += $(TILER_CNN_KERNEL_PATH)/CNN_Conv_BasicKernels.c
MODEL_LIB_POW2 += $(TILER_CNN_KERNEL_PATH)/CNN_Conv_DP_BasicKernels.c
MODEL_LIB_POW2 += $(TILER_CNN_KERNEL_PATH)/CNN_Conv_DW_BasicKernels.c
MODEL_LIB_POW2 += $(TILER_CNN_KERNEL_PATH)/CNN_Conv_DW_DP_BasicKernels.c
MODEL_LIB_POW2 += $(TILER_CNN_KERNEL_PATH)/CNN_Pooling_BasicKernels.c
MODEL_LIB_POW2 += $(TILER_CNN_KERNEL_PATH)/CNN_MatAlgebra.c
MODEL_LIB_POW2 += $(TILER_CNN_KERNEL_PATH)/CNN_SoftMax.c
MODEL_LIB_INCLUDE_POW2 = 
MODEL_GEN_POW2 += $(TILER_CNN_GENERATOR_PATH)/CNN_Generators.c
MODEL_GEN_INCLUDE_POW2 = 

MODEL_LIB_SQ8 += $(TILER_CNN_KERNEL_PATH_SQ8)/CNN_Activation_SQ8.c
MODEL_LIB_SQ8 += $(TILER_CNN_KERNEL_PATH_SQ8)/CNN_Activation_HWC_SQ8.c
MODEL_LIB_SQ8 += $(TILER_CNN_KERNEL_PATH_SQ8)/CNN_Bias_Linear_SQ8.c
MODEL_LIB_SQ8 += $(TILER_CNN_KERNEL_PATH_SQ8)/CNN_Conv_SQ8.c
MODEL_LIB_SQ8 += $(TILER_CNN_KERNEL_PATH_SQ8)/CNN_MatMul_Conv_SQ8.c
MODEL_LIB_SQ8 += $(TILER_CNN_KERNEL_PATH_SQ8)/CNN_Pooling_SQ8.c
MODEL_LIB_SQ8 += $(TILER_CNN_KERNEL_PATH_SQ8)/CNN_Conv_DW_SQ8.c
MODEL_LIB_SQ8 += $(TILER_CNN_KERNEL_PATH_SQ8)/CNN_Conv_DW_Red_SQ8.c
MODEL_LIB_SQ8 += $(TILER_CNN_KERNEL_PATH_SQ8)/CNN_MatAlgebra_SQ8.c
MODEL_LIB_SQ8 += $(TILER_CNN_KERNEL_PATH_SQ8)/CNN_SoftMax_SQ8.c
MODEL_LIB_SQ8 += $(TILER_CNN_KERNEL_PATH_SQ8)/RNN_SQ8.c
MODEL_LIB_INCLUDE_SQ8 = -I$(TILER_CNN_KERNEL_PATH_SQ8)
MODEL_GEN_SQ8 += $(TILER_CNN_GENERATOR_PATH_SQ8)/CNN_Generators_SQ8.c
MODEL_GEN_SQ8 += $(TILER_CNN_GENERATOR_PATH_SQ8)/RNN_Generators_SQ8.c
MODEL_GEN_INCLUDE_SQ8 = -I$(TILER_CNN_GENERATOR_PATH_SQ8)

MODEL_LIB_NE16 += $(TILER_CNN_KERNEL_PATH_NE16)/CNN_BasicKernels_NE16.c
MODEL_LIB_NE16 += $(TILER_CNN_KERNEL_PATH_NE16)/RNN_BasicKernels_NE16.c
MODEL_LIB_INCLUDE_NE16 = -I$(TILER_CNN_KERNEL_PATH_NE16)
MODEL_GEN_NE16 += $(TILER_CNN_GENERATOR_PATH_NE16)/CNN_Generators_NE16.c
MODEL_GEN_NE16 += $(TILER_CNN_GENERATOR_PATH_NE16)/RNN_Generators_NE16.c
MODEL_GEN_INCLUDE_NE16 = -I$(TILER_CNN_GENERATOR_PATH_NE16)

MODEL_LIB_FP16 += $(TILER_CNN_KERNEL_PATH_FP16)/CNN_Bias_Linear_Activation_fp16.c
MODEL_LIB_FP16 += $(TILER_CNN_KERNEL_PATH_FP16)/CNN_Conv_BasicKernels_fp16.c
MODEL_LIB_FP16 += $(TILER_CNN_KERNEL_PATH_FP16)/CNN_Conv_DW_BasicKernels_fp16.c
MODEL_LIB_FP16 += $(TILER_CNN_KERNEL_PATH_FP16)/CNN_MatMul_Conv_fp16.c
MODEL_LIB_FP16 += $(TILER_CNN_KERNEL_PATH_FP16)/CNN_MatAlgebra_fp16.c
MODEL_LIB_FP16 += $(TILER_CNN_KERNEL_PATH_FP16)/CNN_Pooling_BasicKernels_fp16.c
MODEL_LIB_FP16 += $(TILER_CNN_KERNEL_PATH_FP16)/CNN_SoftMax_fp16.c
MODEL_LIB_FP16 += $(TILER_CNN_KERNEL_PATH_FP16)/RNN_fp16.c
MODEL_LIB_INCLUDE_FP16 = -I$(TILER_CNN_KERNEL_PATH_FP16)
MODEL_GEN_FP16 += $(TILER_CNN_GENERATOR_PATH_FP16)/CNN_Generators_fp16.c
MODEL_GEN_FP16 += $(TILER_CNN_GENERATOR_PATH_FP16)/RNN_Generators_fp16.c
MODEL_GEN_FP16 += $(TILER_CNN_GENERATOR_PATH_FP16)/SSD_Generators_fp16.c
MODEL_GEN_INCLUDE_FP16 = -I$(TILER_CNN_GENERATOR_PATH_FP16)

MODEL_LIB_DSP += $(TILER_DSP_KERNEL_PATH)/CmplxFunctions.c
MODEL_LIB_DSP += $(TILER_DSP_KERNEL_PATH)/MatMulDSP.c
MODEL_LIB_DSP += $(TILER_DSP_KERNEL_PATH)/FFT_Library.c
MODEL_LIB_DSP += $(TILER_DSP_KERNEL_PATH)/MfccBasicKernels.c
MODEL_LIB_DSP += $(TILER_DSP_KERNEL_PATH)/PreProcessing.c
MODEL_LIB_DSP += $(TILER_DSP_KERNEL_PATH)/math_funcs.c 
MODEL_LIB_DSP += $(TILER_DSP_KERNEL_PATH)/pulp_dsp/plp_cos_f32s_xpulpv2.c
MODEL_LIB_DSP += $(TILER_DSP_KERNEL_PATH)/pulp_dsp/plp_sin_f32s_xpulpv2.c 
MODEL_LIB_DSP += $(TILER_DSP_KERNEL_PATH)/pulp_dsp/plp_common_tables.c

MODEL_SIZE_CFLAGS = -DAT_INPUT_HEIGHT=$(AT_INPUT_HEIGHT) -DAT_INPUT_WIDTH=$(AT_INPUT_WIDTH) -DAT_INPUT_COLORS=$(AT_INPUT_COLORS)

# Common Files for both quantization schemes
CNN_GEN = $(TILER_CNN_GENERATOR_PATH)/CNN_Generator_Util.c $(TILER_CNN_GENERATOR_PATH)/CNN_Copy_Generators.c $(TILER_CNN_GENERATOR_PATH)/SSD_Generators.c $(TILER_BILINEAR_RESIZE_GENERATOR_PATH)/ResizeGenerator.c  $(TILER_DSP_GENERATOR_PATH)/DSP_Generators.c
CNN_GEN_INCLUDE = -I$(TILER_CNN_GENERATOR_PATH) -I$(TILER_BILINEAR_RESIZE_GENERATOR_PATH) -I$(TILER_CNN_KERNEL_PATH) -I$(TILER_CNN_KERNEL_PATH_FP16) -I$(TILER_DSP_GENERATOR_PATH)
CNN_LIB = $(TILER_CNN_KERNEL_PATH)/SSD_BasicKernels.c $(TILER_BILINEAR_RESIZE_KERNEL_PATH)/ResizeBasicKernels.c $(TILER_CNN_KERNEL_PATH)/CNN_Copy.c $(TILER_CNN_KERNEL_PATH_SQ8)/CNN_AT_Misc.c $(MODEL_LIB_DSP)
CNN_LIB_INCLUDE = -I$(TILER_BILINEAR_RESIZE_KERNEL_PATH) -I$(TILER_CNN_KERNEL_PATH) -I$(TILER_DSP_KERNEL_PATH) -I$(TILER_CNN_KERNEL_PATH_FP16)

ifdef MODEL_SQ8
  CNN_GEN += $(MODEL_GEN_SQ8)
  CNN_GEN_INCLUDE += $(MODEL_GEN_INCLUDE_SQ8)
  CNN_LIB += $(MODEL_LIB_SQ8)
  CNN_LIB_INCLUDE += $(MODEL_LIB_INCLUDE_SQ8)
endif
ifdef MODEL_POW2
  CNN_GEN += $(MODEL_GEN_POW2)
  CNN_GEN_INCLUDE += $(MODEL_GEN_INCLUDE_POW2)
  CNN_LIB += $(MODEL_LIB_POW2)
  CNN_LIB_INCLUDE += $(MODEL_LIB_INCLUDE_POW2)
endif
ifdef MODEL_FP16
  CNN_GEN += $(MODEL_GEN_FP16)
  CNN_GEN_INCLUDE += $(MODEL_GEN_INCLUDE_FP16)
  CNN_LIB += $(MODEL_LIB_FP16) $(TILER_DSP_KERNEL_PATH)/float_math_funcs.c
  CNN_LIB_INCLUDE += $(MODEL_LIB_INCLUDE_FP16)
endif
ifeq ($(MODEL_NE16), 1)
	CNN_GEN += $(MODEL_GEN_NE16)
	CNN_GEN_INCLUDE += $(MODEL_GEN_INCLUDE_NE16)
	CNN_LIB += $(MODEL_LIB_NE16)
	CNN_LIB_INCLUDE += $(MODEL_LIB_INCLUDE_NE16)
endif
